//
//  ViewControllerHeaderView.m
//  XQSqliteDemo
//
//  Created by WXQ on 2021/3/8.
//

#import "ViewControllerHeaderView.h"
#import <Masonry/Masonry.h>

@implementation ViewControllerHeaderView

- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithReuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.titleLab = [UILabel new];
        [self.contentView addSubview:self.titleLab];
        
        self.addBtn = [UIButton new];
        [self.contentView addSubview:self.addBtn];
        
        self.deleteBtn = [UIButton new];
        [self.contentView addSubview:self.deleteBtn];
        
        // 布局
        [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(12);
            make.right.equalTo(self.deleteBtn.mas_left).offset(-12);
            make.centerY.equalTo(self.contentView);
        }];
        
        [self.addBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.mas_equalTo(-12);
            make.centerY.equalTo(self.contentView);
            make.size.mas_equalTo(CGSizeMake(60, 35));
        }];
        
        [self.deleteBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.addBtn.mas_left).offset(-12);
            make.centerY.equalTo(self.contentView);
            make.size.equalTo(self.addBtn);
        }];
        
        // 设置属性
        self.addBtn.backgroundColor = [UIColor orangeColor];
        [self.addBtn setTitle:@"添加" forState:UIControlStateNormal];
        
        self.deleteBtn.backgroundColor = [UIColor redColor];
        [self.deleteBtn setTitle:@"删除" forState:UIControlStateNormal];
        
        self.titleLab.numberOfLines = 0;
        
    }
    return self;
}

@end
